/*导入RouterModule，Routes类型*/
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

import { LoginPage } from "../pages/login/login";
import { HomePage } from "../pages/home/home";
import { PersonalPage } from "../pages/personal/personal";
import { ProductOrderPage } from '../pages/product-order/product-order';
import { LineAttendancePage } from '../pages/line-attendance/line-attendance';
import { ProductStatisticsPage } from '../pages/product-statistics/product-statistics';
import { SettingsPage } from "../pages/settings/settings";
import { accountNumberSecurityPage } from '../pages/accountNumber-security/accountNumber-security';
import { ModifyPasswordPage } from '../pages/modify-password/modify-password';
import { BindingPhonePage } from '../pages/binding-phone/binding-phone';
import { AboutUsPage } from '../pages/about-us/about-us';
import { AnnualStatisticsPage } from '../pages/annual-statistics/annual-statistics';

/*定义路由const表示不可改变*/
const routers: Routes = [
  /*
   path：字符串，表示默认登入,
   path为路径 /login component:组件
   component：组件
   pathMatch：为字符串默认为前缀匹配 "prefix"; "full" 为完全匹配。
   redirectTo：指向为路径，既path
   outlet：字符串，路由目标，面对多个路由的情况
   children：Routes 子路由相关
   */
  {
    path: '',
    redirectTo: '/login',
    pathMatch: 'full'  // 整个路由是空字符串重定向到login组件
  },
  {
    path: 'login',
    component: LoginPage
  },
  {
    path: 'home',
    component: HomePage
  },
  {
    // 个人资料
    path: 'person',
    component: PersonalPage
  },
  {
    //生产订单
    path: 'productOrder',
    component: ProductOrderPage
  },
  {
    path: 'lineAttendance',
    component: LineAttendancePage
  },
  {
    path: 'productStatistics',
    component: ProductStatisticsPage
  },
  {
    path: 'settings',
    component: SettingsPage
  },
  {
    path: 'accountNumber',
    component: accountNumberSecurityPage
  },
  {
    path: 'ModifyPassword',
    component: ModifyPasswordPage
  },
  {
    path: 'BindingPhonePage',
    component: BindingPhonePage
  },
  {
    path: 'aboutUs',
    component: AboutUsPage
  },
  {
    path: 'annualStatistics',
    component: AnnualStatisticsPage
  }
];


/*将路由设置导出,子模块中的路由使用 forChild 而不是 forRoot*/
@NgModule({
  imports: [
    RouterModule.forRoot(routers)
  ],
  exports: [
    RouterModule
  ]
})
export class AppRoutesModule{};
